import math


class Solution:
    def smallestDivisor(self, nums: list, threshold: int) -> int:
        left = 1
        right = max(nums)
        while left < right:
            mid = (left + right) // 2
            divSum = 0
            for num in nums:
                divSum += math.ceil(num / mid)
            if divSum > threshold:
                left = mid + 1
            else:
                right = mid

        return right
